#include "syntax_parser.h"
#include "errors_warnings.h"

#include "main_container.h"
extern MainContainer * CompilerData;

//<class_definition> ~ <class_mods> <template_definition> class NAME <class_inherit> { <using_directives> <class_body_add> }  {abstract, public, private, protected, final, template, class}
void Parser::Parse_ClassDefinition(SyntaxTreeNode * parent)
{
#ifdef TRACE
	CompilerData->LogTrace->ReportEntry("Parse_ClassDefinition");
#endif
	LexicUnit currentUnit;
	// get current lexic unit
	currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
	// if current lexic unit is in the select set of {abstract, public, private, protected, final, template, class}
	if(currentUnit.type == LUTypeKeyword && (currentUnit.subtype == KeywordAbstract 
		|| currentUnit.subtype == KeywordPublic || currentUnit.subtype == KeywordPrivate 
		|| currentUnit.subtype == KeywordProtected || currentUnit.subtype == KeywordFinal 
		|| currentUnit.subtype == KeywordTemplate || currentUnit.subtype == KeywordClass))
	{
		// write type of production in this node
		parent->Production =Gr_ClassDefinition__ClassMods_TemplateDefinition_class_NAME_ClassInherit_spLCBrac_UsingDirectives_ClassBodyAdd_spRCBrac;

		// process nonterminal symbol <class_mods> 
		SyntaxTreeNode * newNode0 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode0);
		Parse_ClassMods(newNode0);

		// process nonterminal symbol <template_definition> 
		SyntaxTreeNode * newNode1 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode1);
		Parse_TemplateDefinition(newNode1);

		// process terminal symbol 'class' 
		currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
		if(currentUnit.type == LUTypeKeyword && currentUnit.subtype == KeywordClass)
		{
			SyntaxTreeNode * newNode2 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode2);
			newNode2->LexUnitID=this->CurrentLexicPosition;
			newNode2->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;
		}
		else
		{
			//report syntactic error
			CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_CLASS_MATCH);
			//increase counter
			CurrentLexicPosition++;
		}

		// process terminal symbol 'NAME' 
		currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
		if(currentUnit.type == LUTypeIdentifier)
		{
			SyntaxTreeNode * newNode3 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode3);
			newNode3->LexUnitID=this->CurrentLexicPosition;
			newNode3->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;
		}
		else
		{
			//report syntactic error
			CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_NAME_MATCH);
			//increase counter
			CurrentLexicPosition++;
		}

		// process nonterminal symbol <class_inherit> 
		SyntaxTreeNode * newNode4 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode4);
		Parse_ClassInherit(newNode4);

		// process terminal symbol '{' 
		currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
		if(currentUnit.type == LUTypeSpecialCharacter && currentUnit.subtype == SpecialCharacterLeftCurlyBrace )
		{
			SyntaxTreeNode * newNode5 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode5);
			newNode5->LexUnitID=this->CurrentLexicPosition;
			newNode5->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;
		}
		else
		{
			//report syntactic error
			CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_LEFT_CURLY_BRACE_MATCH);
			//increase counter
			CurrentLexicPosition++;
		}

		// process nonterminal symbol <using_directives> 
		SyntaxTreeNode * newNode6 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode6);
		Parse_UsingDirectives(newNode6);

		// process nonterminal symbol <class_body_add> 
		SyntaxTreeNode * newNode7 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode7);
		Parse_ClassBodyAdd(newNode7);

		// process terminal symbol '}' 
		currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
		if(currentUnit.type == LUTypeSpecialCharacter && currentUnit.subtype == SpecialCharacterRightCurlyBrace)
		{
			SyntaxTreeNode * newNode8 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode8);
			newNode8->LexUnitID=this->CurrentLexicPosition;
			newNode8->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;
		}
		else
		{
			//report syntactic error
			CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_RIGHT_CURLY_BRACE_MATCH);
			//increase counter
			CurrentLexicPosition++;
		}
	}
	else
	{
		// ERROR has been found
		// REPORT ERROR
		CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_CLASS_DEFINITION_BEGINING);
		// This is recovoring from error
        this->CurrentLexicPosition++;
	}
#ifdef TRACE
	CompilerData->LogTrace->ReportExit("Parse_ClassDefinition");
#endif
}

// <class_mod> ~ abstract  {abstract}
// <class_mod> ~ public  {public}
// <class_mod> ~ private  {private}
// <class_mod> ~ protected  {protected}
// <class_mod> ~ final  {final}
void Parser::Parse_ClassMod(SyntaxTreeNode * parent)
{
#ifdef TRACE
	CompilerData->LogTrace->ReportEntry("Parse_ClassMod");
#endif
	
	LexicUnit currentUnit;
	// get current lexic unit
	currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
	// if current lexic unit is in the select set of {abstract}
	if(currentUnit.type == LUTypeKeyword && currentUnit.subtype == KeywordAbstract)
	{
		// write type of production in this node
		parent->Production =Gr_ClassMod__abstract;

		// process terminal symbol 'abstract' 
		SyntaxTreeNode * newNode0 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode0);
		newNode0->LexUnitID=this->CurrentLexicPosition;
		newNode0->Production=Gr_Terminal;
		//increase counter
		CurrentLexicPosition++;

	}
	// if current lexic unit is in the select set of {public}
	else if(currentUnit.type == LUTypeKeyword && currentUnit.subtype == KeywordPublic)
	{
		// write type of production in this node
		parent->Production =Gr_ClassMod__public;

		// process terminal symbol 'public' 
		SyntaxTreeNode * newNode0 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode0);
		newNode0->LexUnitID=this->CurrentLexicPosition;
		newNode0->Production=Gr_Terminal;
		//increase counter
		CurrentLexicPosition++;
	}
	// if current lexic unit is in the select set of {private}
	else if(currentUnit.type == LUTypeKeyword && currentUnit.subtype == KeywordPrivate)
	{
		// write type of production in this node
		parent->Production =Gr_ClassMod__private;

		// process terminal symbol 'private' 
		SyntaxTreeNode * newNode0 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode0);
		newNode0->LexUnitID=this->CurrentLexicPosition;
		newNode0->Production=Gr_Terminal;
		//increase counter
		CurrentLexicPosition++;
	}
	// if current lexic unit is in the select set of {protected}
	else if(currentUnit.type == LUTypeKeyword && currentUnit.subtype == KeywordProtected)
	{
		// write type of production in this node
		parent->Production =Gr_ClassMod__protected;

		// process terminal symbol 'protected' 
			SyntaxTreeNode * newNode0 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode0);
			newNode0->LexUnitID=this->CurrentLexicPosition;
			newNode0->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;

	}
	// if current lexic unit is in the select set of {final}
	else if(currentUnit.type == LUTypeKeyword && currentUnit.subtype == KeywordFinal)
	{
		// write type of production in this node
		parent->Production =Gr_ClassMod__final;

		// process terminal symbol 'final' 
			SyntaxTreeNode * newNode0 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode0);
			newNode0->LexUnitID=this->CurrentLexicPosition;
			newNode0->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;

	}
	else
	{
		// ERROR has been found
		// REPORT ERROR
		CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_CLASS_MOD_BEGINING);
		// This is recovoring from error
        this->CurrentLexicPosition++;
	}
#ifdef TRACE
	CompilerData->LogTrace->ReportExit("Parse_ClassMod");
#endif
}

// <class_inherit> ~ : <class_inherit_name>  {:}
// <class_inherit> ~ ? {{}
	
void Parser::Parse_ClassInherit(SyntaxTreeNode * parent)
{
#ifdef TRACE
	CompilerData->LogTrace->ReportEntry("Parse_ClassInherit");
#endif
	LexicUnit currentUnit;
	// get current lexic unit
	currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
	// if current lexic unit is in the select set of {:}
	if(currentUnit.type == LUTypeSpecialCharacter && currentUnit.subtype == SpecialCharacterColon)
	{
		// write type of production in this node
		parent->Production =Gr_ClassInherit__spColon_ClassInheritName;

		// process terminal symbol ':' 
			SyntaxTreeNode * newNode0 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode0);
			newNode0->LexUnitID=this->CurrentLexicPosition;
			newNode0->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;

		// process nonterminal symbol <class_inherit_name> 
		SyntaxTreeNode * newNode1 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode1);
		Parse_ClassInheritName(newNode1);

	}
   else if(currentUnit.type == LUTypeSpecialCharacter && currentUnit.subtype == SpecialCharacterLeftCurlyBrace)
   {
      // write type of production in this node
		parent->Production =Gr_ClassInherit__epsilon;

   }
	else
	{
		// ERROR has been found
		// REPORT ERROR
		CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_CLASS_INHERIT_BEGINING);
		// This is recovoring from error
        this->CurrentLexicPosition++;
	}
#ifdef TRACE
	CompilerData->LogTrace->ReportExit("Parse_ClassInherit");
#endif
}

// <constructor_definition> ~ <constr_mod> NAME ( <parameters> ) <constr_inherit> <constr_body>  {public, private, protected, NAME}
void Parser::Parse_ConstructorDefinition(SyntaxTreeNode * parent)
{
#ifdef TRACE
	CompilerData->LogTrace->ReportEntry("Parse_ConstructorDefinition");
#endif
	LexicUnit currentUnit;
	// get current lexic unit
	currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
	// if current lexic unit is in the select set of {public, private, protected, NAME}
	if((currentUnit.type == LUTypeKeyword && (currentUnit.subtype == KeywordPublic 
		|| currentUnit.subtype == KeywordPrivate || currentUnit.subtype == KeywordProtected))
		|| currentUnit.type == LUTypeIdentifier)
	{
		// write type of production in this node
		parent->Production =Gr_ConstructorDefinition__ConstrMod_NAME_spLPar_Parameters_spRPar_ConstrInherit_ConstrBody;

		// process nonterminal symbol <constr_mod> 
		SyntaxTreeNode * newNode0 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode0);
		Parse_ConstrMod(newNode0);

		// process terminal symbol 'NAME' 
		currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
		if(currentUnit.type == LUTypeIdentifier)
		{
			SyntaxTreeNode * newNode1 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode1);
			newNode1->LexUnitID=this->CurrentLexicPosition;
			newNode1->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;
		}
		else
		{
			//report syntactic error
			CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_NAME_MATCH);
			//increase counter
			CurrentLexicPosition++;
		}

		// process terminal symbol '(' 
		currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
		if(currentUnit.type == LUTypeSpecialCharacter && currentUnit.subtype == SpecialCharacterLeftParenthesis)
		{
			SyntaxTreeNode * newNode2 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode2);
			newNode2->LexUnitID=this->CurrentLexicPosition;
			newNode2->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;
		}
		else
		{
			//report syntactic error
			CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_LEFT_PARENTHESIS_MATCH);
			//increase counter
			CurrentLexicPosition++;
		}

		// process nonterminal symbol <parameters> 
		SyntaxTreeNode * newNode3 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode3);
		Parse_Parameters(newNode3);

		// process terminal symbol ')' 
		currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
		if(currentUnit.type == LUTypeSpecialCharacter && currentUnit.subtype == SpecialCharacterRightParenthesis)
		{
			SyntaxTreeNode * newNode4 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode4);
			newNode4->LexUnitID=this->CurrentLexicPosition;
			newNode4->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;
		}
		else
		{
			//report syntactic error
			CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_RIGHT_PARENTHESIS_MATCH);
			//increase counter
			CurrentLexicPosition++;
		}

		// process nonterminal symbol <constr_inherit> 
		SyntaxTreeNode * newNode5 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode5);
		Parse_ConstrInherit(newNode5);

		// process nonterminal symbol <constr_body> 
		SyntaxTreeNode * newNode6 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode6);
		Parse_ConstrBody(newNode6);

	}
	else
	{
		// ERROR has been found
		// REPORT ERROR
		CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_CONSTRUCTOR_DEFINITION_BEGINING);
		// This is recovoring from error
        this->CurrentLexicPosition++;
	}
#ifdef TRACE
	CompilerData->LogTrace->ReportExit("Parse_ConstructorDefinition");
#endif
}

// <constr_mod> ~ public  {public}
// <constr_mod> ~ private  {private}
// <constr_mod> ~ protected  {protected}
// <constr_mod> ~ ? {NAME}
void Parser::Parse_ConstrMod(SyntaxTreeNode * parent)
{
#ifdef TRACE
	CompilerData->LogTrace->ReportEntry("Parse_ConstrMod");
#endif	
	LexicUnit currentUnit;
	// get current lexic unit
	currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
	// if current lexic unit is in the select set of {public}
	if(currentUnit.type == LUTypeKeyword && currentUnit.subtype == KeywordPublic)
	{
		// write type of production in this node
		parent->Production =Gr_ConstrMod__public;

		// process terminal symbol 'public' 
			SyntaxTreeNode * newNode0 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode0);
			newNode0->LexUnitID=this->CurrentLexicPosition;
			newNode0->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;

	}
	// if current lexic unit is in the select set of {private}
	else if(currentUnit.type == LUTypeKeyword && currentUnit.subtype == KeywordPrivate)
	{
		// write type of production in this node
		parent->Production =Gr_ConstrMod__private;

		// process terminal symbol 'private' 
			SyntaxTreeNode * newNode0 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode0);
			newNode0->LexUnitID=this->CurrentLexicPosition;
			newNode0->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;

	}
	// if current lexic unit is in the select set of {protected}
	else if(currentUnit.type == LUTypeKeyword && currentUnit.subtype == KeywordProtected)
	{
		// write type of production in this node
		parent->Production =Gr_ConstrMod__protected;

		// process terminal symbol 'protected' 
			SyntaxTreeNode * newNode0 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode0);
			newNode0->LexUnitID=this->CurrentLexicPosition;
			newNode0->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;

	}

	else if(currentUnit.type == LUTypeIdentifier)
	{
		// write type of production in this node
		parent->Production =Gr_ConstrMod__epsilon;

	}
	else
	{
		// ERROR has been found
		// REPORT ERROR
		CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_CONSTR_MOD_BEGINING);
		// This is recovoring from error
        this->CurrentLexicPosition++;
	}
#ifdef TRACE
	CompilerData->LogTrace->ReportExit("Parse_ConstrMod");
#endif
}

// <constr_inherit> ~ : <name> ( <arguments> )  {:}
// <constr_inherit> ~ ? {;, {}
void Parser::Parse_ConstrInherit(SyntaxTreeNode * parent)
{
#ifdef TRACE
	CompilerData->LogTrace->ReportEntry("Parse_ConstrInherit");
#endif	
	LexicUnit currentUnit;
	// get current lexic unit
	currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
	// if current lexic unit is in the select set of {:}
	if(currentUnit.type == LUTypeSpecialCharacter && currentUnit.subtype == SpecialCharacterColon)
	{
		// write type of production in this node
		parent->Production =Gr_ConstrInherit__spColon_Name_spLPar_Arguments_spRPar;

		// process terminal symbol ':' 
		SyntaxTreeNode * newNode0 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode0);
		newNode0->LexUnitID=this->CurrentLexicPosition;
		newNode0->Production=Gr_Terminal;
		//increase counter
		CurrentLexicPosition++;

		// process nonterminal symbol <name> 
		SyntaxTreeNode * newNode1 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode1);
		Parse_Name(newNode1);

		// process terminal symbol '(' 
		currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
		if(currentUnit.type == LUTypeSpecialCharacter && currentUnit.subtype == SpecialCharacterLeftParenthesis )
		{
			SyntaxTreeNode * newNode2 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode2);
			newNode2->LexUnitID=this->CurrentLexicPosition;
			newNode2->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;
		}
		else
		{
			//report syntactic error
			CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_LEFT_PARENTHESIS_MATCH);
			//increase counter
			CurrentLexicPosition++;
		}

		// process nonterminal symbol <arguments> 
		SyntaxTreeNode * newNode3 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode3);
		Parse_Arguments(newNode3);

		// process terminal symbol ')' 
		currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
		if( currentUnit.type == LUTypeSpecialCharacter && currentUnit.subtype == SpecialCharacterRightParenthesis  )
		{
			SyntaxTreeNode * newNode4 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode4);
			newNode4->LexUnitID=this->CurrentLexicPosition;
			newNode4->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;
		}
		else
		{
			//report syntactic error
			CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_RIGHT_PARENTHESIS_MATCH);
			//increase counter
			CurrentLexicPosition++;
		}

	}
	// if current lexic unit is in the select set of {;, {}
	else if(currentUnit.type == LUTypeSpecialCharacter && (currentUnit.subtype == SpecialCharacterSemicolon 
		|| currentUnit.subtype == SpecialCharacterLeftCurlyBrace))
	{
		// write type of production in this node
		parent->Production =Gr_ConstrInherit__epsilon;

	}


	else
	{
		// ERROR has been found
		// REPORT ERROR
		CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_CONSTR_INHERIT_BEGINING);
		// This is recovoring from error
        this->CurrentLexicPosition++;
	}
#ifdef TRACE
	CompilerData->LogTrace->ReportExit("Parse_ConstrInherit");
#endif
}

// <constr_body> ~ ;  {;}
// <constr_body> ~ { <method_body> }  {{}
void Parser::Parse_ConstrBody(SyntaxTreeNode * parent)
{
#ifdef TRACE
	CompilerData->LogTrace->ReportEntry("Parse_ConstrBody");
#endif	
	LexicUnit currentUnit;
	// get current lexic unit
	currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
	// if current lexic unit is in the select set of {;}
	if(currentUnit.type == LUTypeSpecialCharacter && currentUnit.subtype == SpecialCharacterSemicolon)
	{
		// write type of production in this node
		parent->Production =Gr_ConstrBody__spSemiCol;

		// process terminal symbol ';' 
		SyntaxTreeNode * newNode0 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode0);
		newNode0->LexUnitID=this->CurrentLexicPosition;
		newNode0->Production=Gr_Terminal;
		//increase counter
		CurrentLexicPosition++;

	}
	// if current lexic unit is in the select set of {{}
	else if(currentUnit.type == LUTypeSpecialCharacter && currentUnit.subtype == SpecialCharacterLeftCurlyBrace)
	{
		// write type of production in this node
		parent->Production =Gr_ConstrBody__spLCBrac_MethodBody_spRCBrac;

		// process terminal symbol '{' 
		SyntaxTreeNode * newNode0 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode0);
		newNode0->LexUnitID=this->CurrentLexicPosition;
		newNode0->Production=Gr_Terminal;
		//increase counter
		CurrentLexicPosition++;

		// process nonterminal symbol <method_body> 
		SyntaxTreeNode * newNode1 = new SyntaxTreeNode();
		parent->Nodes->Add(newNode1);
		Parse_MethodBody(newNode1);

		// process terminal symbol '}' 
		currentUnit = CompilerData->Units->GetLexicUnit(this->CurrentLexicPosition);
		if( currentUnit.type == LUTypeSpecialCharacter && currentUnit.subtype == SpecialCharacterRightCurlyBrace )
		{
			SyntaxTreeNode * newNode2 = new SyntaxTreeNode();
			parent->Nodes->Add(newNode2);
			newNode2->LexUnitID=this->CurrentLexicPosition;
			newNode2->Production=Gr_Terminal;
			//increase counter
			CurrentLexicPosition++;
		}
		else
		{
			//report syntactic error
			CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_RIGHT_CURLY_BRACE_MATCH);
			//increase counter
			CurrentLexicPosition++;
		}

	}


	else
	{
		// ERROR has been found
		// REPORT ERROR
		CompilerData->ErrorWarningReport->ReportError(&currentUnit, ERR_SYN_NO_CONSTR_BODY_BEGINING);
		// This is recovoring from error
        this->CurrentLexicPosition++;
	}
#ifdef TRACE
	CompilerData->LogTrace->ReportExit("Parse_ConstrBody");
#endif
}

